-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add file input to WebView #12807
Add file input to WebView #12807
Conversation
works perfectly for me! just what we need. |
Tested manually on: Samsung Galaxy S7 Edge, Samsung Galaxy S5, Nexus 6P emulator, LG v20 |
Fixes #11230 |
Any update or ETA on this? |
Sadly no one has reviewed it yet. |
Would be great to see this merged. @jacobp100 |
Sorry, I don't have power to merge things! The code looks good, but I just have a few questions, Is it possible to handle this use-case using #10946? I know that PR hasn't landed, but it is useful for other reviewers to know. Does this work for things uploads than images? What happens if a user is on an older version of Android? |
To answer your questions:
|
Anyone know who needs pinging to get this reviewed? |
@headlessme @farazs I think the If the |
sounds good. I can update the PR to include only those changes. I'm not sure how close that PR is to being merged though. Is it possible it becomes stale and does not end up being merged? |
I'm working hard with the author to get it published soon! |
Why doesn't anyone merge it? We need it ASAP |
Any update ? |
#10946 has still not been merged. So if this PR will not be merged as is, it's not possible to implement this using that until it is merged and released in a new RN version. |
I'm interested in this merge also. |
@farazs |
@mantou132 I'm not sure what you mean by that, but you're welcome to try it out and see! :) |
multiple file & MIME type:
Also do not need to set the title: multiple file receive:
|
It seems like #15016 was approved, any chance this might be merged anytime soon? |
I need this too 😢 , any chance it's coming soon ? |
I need this too T____T |
Need this too :-) |
Please go ahead and and split this out into a separate package, now that the other PR has landed. |
Here's a sample of what I did to get Android WebView file upload working in my project, in case it is helpful to anyone else. I suspect one could make an external package based off of that, but I've not dove in to that. Hope it helps someone! |
this is terrible! why would this be split up in a different package? for the sake of argument, this package can become stale and not get any new features that get added to react-native. @farazs could this work/be made as a higher order component? |
Still waiting for this, with an app which should've gone into production a long time ago. |
WebView accounts for a good chunk of issues opened on the repo, but these issues don't seem to affect Facebook's own internal use cases. This is why I highly recommend that the community step in and provide a WebView module. |
Sorry I have not had time to take a look at this. It doesn't seem like it will get merged into the WebView component itself though I'm not sure why. Are no further improvements going to be made to the react-native webview? Until it's actually pulled out into it's own community WebView module how are any updates going to be made? Someone would have to put the time creating and owning the WebView module and I don't think I can be that person. If someone creates such a module I would be happy to port this PR over there. |
Hi @farazs, thanks for your share. Unfortunately it doesn't work to me. |
@yihanseattle the change of this PR works? could you share some experience? |
@guguji5 I'm not sure what you mean. Even without support for , the issue is that nothing happens in the webview. Are you saying the element itself is not in your webview? That may be an issue with the page you are trying to load. You would need to fork react native, apply these changes to that fork, and then use that fork when building your application. See https://facebook.github.io/react-native/docs/building-from-source.html |
We are using these changes in production so they definitely do work for me. master may have diverged from this branch significantly so the changes might need to be altered slightly. |
@farazs yes. I can't see the element |
@farazs I modify the react native file in the node_module folder of my project according to this PR changes, and run |
@guguji5 Please see the link I posted. Editing the node_modules folder is not sufficient to get your project to build the source from there. For further issues, your questions might be better suited to stackoverflow as it's not specific to this pull request but regarding building react-native from source for Android in general. |
@farazs ok .thank you very much. |
Add file input to WebView facebook#12807 facebook#12807
Add file input to WebView facebook#12807 facebook#12807
Hope this answer will help you. |
Fixes #5219 which was moved to ProductPains. Allows file input in a webview. Previously attempting to use file input would do nothing in the webview. Now the default dialog is shown allowing you to pick Camera to take a picture or Photos/Gallery to select an existing photo.
The problem in fixing this before was that this was accomplished by using undocumented APIs for earlier versions of Android. However, for 5.0+ there is a documented API for this. Since there is no documented way to fix this for earlier versions of Android, it seems better to have a solution for 5.0+ than no solution at all.
Based on this example: https://github.com/GoogleChrome/chromium-webview-samples/tree/master/input-file-example/
The
ActivityEventListener
does not work if it is attached to theThemedReactContext
itself but needs to be added to the originalReactContext
similar to howLifecycleEventListener
is handled.